<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Solr vs Elasticsearch：深度对比分析</title>
    <link href="https://cdn.staticfile.org/font-awesome/6.4.0/css/all.min.css" rel="stylesheet">
    <link href="https://cdn.staticfile.org/tailwindcss/2.2.19/tailwind.min.css" rel="stylesheet">
    <link href="https://fonts.googleapis.com/css2?family=Noto+Serif+SC:wght@400;500;600;700&family=Noto+Sans+SC:wght@300;400;500;700&display=swap" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/mermaid@latest/dist/mermaid.min.js"></script>
    <style>
        body {
            font-family: 'Noto Sans SC', Tahoma, Arial, Roboto, "Droid Sans", "Helvetica Neue", "Droid Sans Fallback", "Heiti SC", "Hiragino Sans GB", Simsun, sans-serif;
            background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
            min-height: 100vh;
        }
        
        /* Hero Section Styles */
        .hero-gradient {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
        }
        
        /* Card Hover Effects */
        .feature-card {
            transition: all 0.3s ease;
            background: rgba(255, 255, 255, 0.95);
            backdrop-filter: blur(10px);
        }
        
        .feature-card:hover {
            transform: translateY(-5px);
            box-shadow: 0 20px 40px rgba(0, 0, 0, 0.1);
        }
        
        /* Typography Enhancements */
        .drop-cap::first-letter {
            float: left;
            font-size: 4rem;
            line-height: 3rem;
            padding-right: 0.5rem;
            margin-top: 0.5rem;
            font-weight: 700;
            color: #667eea;
            font-family: 'Noto Serif SC', serif;
        }
        
        /* Section Headers */
        .section-header {
            position: relative;
            padding-left: 1.5rem;
        }
        
        .section-header::before {
            content: '';
            position: absolute;
            left: 0;
            top: 50%;
            transform: translateY(-50%);
            width: 4px;
            height: 100%;
            background: linear-gradient(180deg, #667eea 0%, #764ba2 100%);
            border-radius: 2px;
        }
        
        /* Comparison Table Styles */
        .comparison-table {
            background: white;
            border-radius: 1rem;
            overflow: hidden;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
        }
        
        .comparison-table th {
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            font-weight: 600;
            padding: 1.5rem;
            text-align: left;
        }
        
        .comparison-table td {
            padding: 1.5rem;
            border-bottom: 1px solid #e5e7eb;
        }
        
        .comparison-table tr:hover {
            background: #f9fafb;
        }
        
        /* Badge Styles */
        .tech-badge {
            display: inline-block;
            padding: 0.25rem 0.75rem;
            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
            color: white;
            border-radius: 9999px;
            font-size: 0.875rem;
            font-weight: 500;
            margin: 0.25rem;
        }
        
        /* Mermaid Diagram Container */
        .mermaid-container {
            background: white;
            border-radius: 1rem;
            padding: 2rem;
            box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
            margin: 2rem 0;
        }
        
        /* Smooth Scroll */
        html {
            scroll-behavior: smooth;
        }
        
        /* Animation */
        @keyframes fadeInUp {
            from {
                opacity: 0;
                transform: translateY(30px);
            }
            to {
                opacity: 1;
                transform: translateY(0);
            }
        }
        
        .animate-fadeInUp {
            animation: fadeInUp 0.8s ease-out;
        }
    </style>
</head>
<body>
    <!-- Hero Section -->
    <section class="hero-gradient text-white py-20">
        <div class="container mx-auto px-6">
            <div class="text-center animate-fadeInUp">
                <h1 class="text-5xl md:text-6xl font-bold mb-6">
                    <i class="fas fa-search mr-4"></i>Solr vs Elasticsearch
                </h1>
                <p class="text-xl md:text-2xl mb-8 opacity-90">深度对比两大搜索引擎巨头</p>
                <div class="flex justify-center space-x-4">
                    <span class="tech-badge"><i class="fas fa-bolt mr-2"></i>高性能</span>
                    <span class="tech-badge"><i class="fas fa-expand-arrows-alt mr-2"></i>可扩展</span>
                    <span class="tech-badge"><i class="fas fa-cogs mr-2"></i>企业级</span>
                </div>
            </div>
        </div>
    </section>

    <!-- Main Content -->
    <main class="container mx-auto px-6 py-12">
        <!-- Introduction -->
        <section class="max-w-4xl mx-auto mb-16">
            <div class="bg-white rounded-2xl shadow-xl p-8 md:p-12">
                <p class="text-lg leading-relaxed text-gray-700 drop-cap">
                    在现代搜索技术领域，<strong class="text-purple-600">Apache Solr</strong> 和 <strong class="text-purple-600">Elasticsearch</strong> 是两个最受欢迎的搜索引擎。它们都基于 Lucene 构建，提供了强大的全文搜索和数据分析能力。然而，它们在架构设计、性能、易用性和生态系统方面存在显著差异。
                </p>
            </div>
        </section>

        <!-- Overview Section -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 section-header">
                <i class="fas fa-info-circle mr-3 text-purple-600"></i>概述对比
            </h2>
            
            <div class="grid md:grid-cols-2 gap-8">
                <!-- Solr Card -->
                <div class="feature-card rounded-2xl p-8 border border-gray-200">
                    <div class="flex items-center mb-4">
                        <div class="w-16 h-16 bg-orange-500 rounded-full flex items-center justify-center mr-4">
                            <i class="fas fa-sun text-white text-2xl"></i>
                        </div>
                        <h3 class="text-2xl font-bold">Apache Solr</h3>
                    </div>
                    <p class="text-gray-700 leading-relaxed mb-4">
                        Apache Solr 是一个基于 Lucene 的开源搜索平台，最初由 Apache 软件基金会开发。Solr 提供了丰富的功能，包括全文搜索、分面搜索、高亮显示、分布式搜索等。
                    </p>
                    <div class="flex flex-wrap">
                        <span class="text-sm bg-orange-100 text-orange-700 px-3 py-1 rounded-full mr-2 mb-2">
                            <i class="fas fa-building mr-1"></i>企业级
                        </span>
                        <span class="text-sm bg-orange-100 text-orange-700 px-3 py-1 rounded-full mr-2 mb-2">
                            <i class="fas fa-shield-alt mr-1"></i>成熟稳定
                        </span>
                        <span class="text-sm bg-orange-100 text-orange-700 px-3 py-1 rounded-full mr-2 mb-2">
                            <i class="fas fa-puzzle-piece mr-1"></i>功能丰富
                        </span>
                    </div>
                </div>

                <!-- Elasticsearch Card -->
                <div class="feature-card rounded-2xl p-8 border border-gray-200">
                    <div class="flex items-center mb-4">
                        <div class="w-16 h-16 bg-green-500 rounded-full flex items-center justify-center mr-4">
                            <i class="fas fa-bolt text-white text-2xl"></i>
                        </div>
                        <h3 class="text-2xl font-bold">Elasticsearch</h3>
                    </div>
                    <p class="text-gray-700 leading-relaxed mb-4">
                        Elasticsearch 是一个分布式、可扩展的搜索和分析引擎，由 Elastic 公司开发。以其近实时搜索、强大的聚合功能和易用性著称，广泛应用于日志分析、全文搜索等场景。
                    </p>
                    <div class="flex flex-wrap">
                        <span class="text-sm bg-green-100 text-green-700 px-3 py-1 rounded-full mr-2 mb-2">
                            <i class="fas fa-rocket mr-1"></i>实时搜索
                        </span>
                        <span class="text-sm bg-green-100 text-green-700 px-3 py-1 rounded-full mr-2 mb-2">
                            <i class="fas fa-chart-line mr-1"></i>数据分析
                        </span>
                        <span class="text-sm bg-green-100 text-green-700 px-3 py-1 rounded-full mr-2 mb-2">
                            <i class="fas fa-plug mr-1"></i>易于集成
                        </span>
                    </div>
                </div>
            </div>
        </section>

        <!-- Architecture Comparison -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 section-header">
                <i class="fas fa-sitemap mr-3 text-purple-600"></i>架构设计对比
            </h2>

            <!-- Architecture Diagram -->
            <div class="mermaid-container">
                <div class="mermaid">
                    graph TB
                        subgraph "Solr Architecture"
                            A[Client] --> B[SolrCloud]
                            B --> C[Zookeeper]
                            B --> D[Leader Node]
                            B --> E[Replica Node]
                            D --> F[Lucene Index]
                            E --> G[Lucene Index]
                        end
                        
                        subgraph "Elasticsearch Architecture"
                            H[Client] --> I[ES Cluster]
                            I --> J[Master Node]
                            I --> K[Data Node]
                            I --> L[Coordinating Node]
                            K --> M[Primary Shard]
                            K --> N[Replica Shard]
                        end
                        
                        style A fill:#ff9800,stroke:#f57c00,color:#fff
                        style H fill:#4caf50,stroke:#388e3c,color:#fff
                        style C fill:#ff5722,stroke:#d84315,color:#fff
                        style J fill:#8bc34a,stroke:#689f38,color:#fff
                </div>
            </div>

            <!-- Comparison Table -->
            <div class="comparison-table mt-8">
                <table class="w-full">
                    <thead>
                        <tr>
                            <th class="w-1/3">特性</th>
                            <th class="w-1/3">Solr</th>
                            <th class="w-1/3">Elasticsearch</th>
                        </tr>
                    </thead>
                    <tbody>
                        <tr>
                            <td class="font-semibold"><i class="fas fa-network-wired mr-2 text-purple-600"></i>分布式架构</td>
                            <td>通过 SolrCloud + Zookeeper 实现</td>
                            <td>原生支持，无需外部组件</td>
                        </tr>
                        <tr>
                            <td class="font-semibold"><i class="fas fa-database mr-2 text-purple-600"></i>数据模型</td>
                            <td>集合（Collection）→ 分片（Shard）</td>
                            <td>索引（Index）→ 分片（Shard）</td>
                        </tr>
                        <tr>
                            <td class="font-semibold"><i class="fas fa-user-tag mr-2 text-purple-600"></i>节点角色</td>
                            <td>主节点（Leader）、副本节点（Replica）</td>
                            <td>主节点、数据节点、协调节点（灵活）</td>
                        </tr>
                    </tbody>
                </table>
            </div>
        </section>

        <!-- Performance Comparison -->
        <section class="mb-16">
            <h2 class="text-3xl font-bold mb-8 section-header">
                <i class="fas fa-tachometer-alt mr-3 text-purple-600"></i>性能对比
            </h2>

            <div class="grid md:grid-cols-3 gap-6">
                <!-- Index Performance -->
                <div class="bg-white rounded-xl p-6 shadow-lg hover:shadow-xl transition-shadow">
                    <div class="text-center mb-4">
                        <div class="w-20 h-20 bg-blue-100 rounded-full flex items-center justify-center mx-auto mb-4">
                            <i class="fas fa-file-import text-blue-600 text-3xl"></i>
                        </div>
                        <h3 class="text-xl font-bold mb-2">索引性能</h3>
                    </div>
                    <div class="space-y-3">
                        <div class="p-3 bg-orange-50 rounded-lg">
                            <p class="font-semibold text-orange-700 mb-1">Solr</p>
                            <p class="text-sm text-gray-600">大规模数据处理优异，高并发写入可能存在瓶颈</p>
                        </div>
                        <div class="p-3